

from urllib import  request
from urllib import  parse

url = 'https://oa-api.magook.com/resource/magazine/list'

data={'page':1,'page_size':20,'tab_type':0}

headers={
'Bk-Access-Token':
'090f9cd29a3ac0f9ab6a29b0557ccfba',
'Bk-Anonymous-Id':
'uACXACNTXITB2T5W6LEO9JGUBIUMHVYY',
'Bk-Api-App':
'client#n4469bop2b!75evs7ce61fd4gys',
'Bk-Api-Signature':
'aZviT9foge1ndOiUASxy/BEcQQg=',
'Bk-Client-Time':
'1708417810208',
'Bk-Route':
'/resource/magazine/list'
}

req= request.Request(url,headers=headers)

# 把对象转为url编码
data= parse.urlencode(data)

#把url编码后的数据转为字节流
data= data.encode()

resp= request.urlopen(req,data=data)
#decide这里read返回的是字节流，使用decode把字节流转为字符串
print(resp.read().decode())


